﻿
Namespace Services.ServiceDefinitions

    Public MustInherit Class ReportService
        Inherits ServiceClass

        Public Sub New(ByVal dataService As DbDataLib.DbDataService)

            MyBase.New(dataService)

        End Sub

        Public MustOverride Function GetReports() As List(Of Reporting.Report)

        Public MustOverride Function GetReport(ByVal id As Integer) As Reporting.Report

        Public MustOverride Function GetReportsForList() As List(Of Reporting.ReportListEntry)

        Public Sub SaveReport(ByRef r As Reporting.Report)
            Call InternalSaveReport(r)
            Call RaiseReportChangedEvent()
        End Sub

        Public Overloads Sub DeleteReport(ByVal r As Reporting.Report)
            Call InternalDeleteReport(r)
            Call RaiseReportChangedEvent()
        End Sub

        Public Overloads Sub DeleteReport(ByVal id As Integer)
            Call InternalDeleteReport(id)
            Call RaiseReportChangedEvent()
        End Sub

        Protected MustOverride Sub InternalSaveReport(ByRef r As Reporting.Report)

        Protected MustOverride Overloads Sub InternalDeleteReport(ByVal r As Reporting.Report)

        Protected MustOverride Overloads Sub InternalDeleteReport(ByVal id As Integer)

        Public Event ReportChanged()

        Public Sub RaiseReportChangedEvent()
            RaiseEvent ReportChanged()
        End Sub

    End Class

End Namespace
